<?php

/**
 * Car filter form base class.
 *
 * @package    symfony
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCarFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'manufacturer_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Manufacturer'), 'add_empty' => true)),
      'mark_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CarModel'), 'add_empty' => true)),
      'model'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'manufactured_year' => new sfWidgetFormFilterInput(),
      'price'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fuel_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FuelType'), 'add_empty' => true)),
      'engine_cap'        => new sfWidgetFormFilterInput(),
      'gearbox_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Gearbox'), 'add_empty' => true)),
      'condition_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Condition'), 'add_empty' => true)),
      'joloo'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SteeringWheel'), 'add_empty' => true)),
      'exterior_color'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ExteriorColor'), 'add_empty' => true)),
      'cardrive_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CarDrive'), 'add_empty' => true)),
      'milage'            => new sfWidgetFormFilterInput(),
      'picture_id'        => new sfWidgetFormFilterInput(),
      'cuzowni_angilal'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'description'       => new sfWidgetFormFilterInput(),
      'create_at'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'update_at'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'enabled'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'user_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')),
      'manufacturer_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Manufacturer'), 'column' => 'id')),
      'mark_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CarModel'), 'column' => 'id')),
      'model'             => new sfValidatorPass(array('required' => false)),
      'manufactured_year' => new sfValidatorPass(array('required' => false)),
      'price'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fuel_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('FuelType'), 'column' => 'id')),
      'engine_cap'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'gearbox_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Gearbox'), 'column' => 'id')),
      'condition_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Condition'), 'column' => 'id')),
      'joloo'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('SteeringWheel'), 'column' => 'id')),
      'exterior_color'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ExteriorColor'), 'column' => 'id')),
      'cardrive_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CarDrive'), 'column' => 'id')),
      'milage'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'picture_id'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cuzowni_angilal'   => new sfValidatorPass(array('required' => false)),
      'description'       => new sfValidatorPass(array('required' => false)),
      'create_at'         => new sfValidatorPass(array('required' => false)),
      'update_at'         => new sfValidatorPass(array('required' => false)),
      'enabled'           => new sfValidatorPass(array('required' => false)),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('car_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Car';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'user_id'           => 'ForeignKey',
      'manufacturer_id'   => 'ForeignKey',
      'mark_id'           => 'ForeignKey',
      'model'             => 'Text',
      'manufactured_year' => 'Text',
      'price'             => 'Number',
      'fuel_id'           => 'ForeignKey',
      'engine_cap'        => 'Number',
      'gearbox_id'        => 'ForeignKey',
      'condition_id'      => 'ForeignKey',
      'joloo'             => 'ForeignKey',
      'exterior_color'    => 'ForeignKey',
      'cardrive_id'       => 'ForeignKey',
      'milage'            => 'Number',
      'picture_id'        => 'Number',
      'cuzowni_angilal'   => 'Text',
      'description'       => 'Text',
      'create_at'         => 'Text',
      'update_at'         => 'Text',
      'enabled'           => 'Text',
      'created_at'        => 'Date',
      'updated_at'        => 'Date',
    );
  }
}
